/**
 * title: useMemo
 */

import { useMemo } from 'react';
import { useState } from 'react';

function App() {
  const [count, setCount] = useState(0);
  const count2 = useMemo(() => {
    return count + 2;
  }, [count]);
  return (
    <div>
      <button onClick={() => setCount(count + 1)}>+1</button>
      <br />
      次数：{count}
      <br />
      次数+2：{count2}
    </div>
  );
}
export default App;
